home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE06 / CLINIC / DBLDLL.DPR < prev    next >
Encoding:
Text File  |  1995-10-22  |  1.0 KB  |  45 lines

  1. library Dbldll;
  2.  
  3. uses
  4.   WinProcs;
  5.  
  6. {$define MSCOMPATIBILITY}
  7. {$ifndef MSCOMPATIBILITY}
  8. function TestFloatPascal(D: Double): Double; export;
  9. begin
  10.   Result := D;
  11. end;
  12.  
  13. function TestFloatCDecl(D: Double): Double; cdecl; export;
  14. begin
  15.   Result := D;
  16. end;
  17. {$else}
  18. type
  19.   PDouble = ^Double;
  20.  
  21. var
  22.   __fac: Double; { Global variable for flops (floating point operations) }
  23.  
  24. function TestFloatPascal(D: Double; Offset: Word): PDouble; export;
  25. begin
  26.   Result := Ptr(SSeg, Offset); { Return address of result on stack }
  27.   Result^ := D; { Store result in stack at given offset }
  28. end;
  29.  
  30. { If the parameter is an Extended (long double), this change won't }
  31. { be necessary - MSC returns it in the same way as Delphi - on the NDP stack}
  32. function TestFloatCDecl(D: Double): PDouble; cdecl; export;
  33. begin
  34.   Result := @__fac; { Return address of result in DLL data segment }
  35.   Result^ := D; { Store result in DLL variable }
  36. end;
  37. {$endif}
  38.  
  39. exports
  40.   TestFloatPascal index 2,
  41.   TestFloatCDecl  index 3;
  42.  
  43. begin
  44. end.
  45.